<template>
	<!-- 添加为商机 -->
	<view class="page">
		<!-- search -->
		<view style="display: flex;flex-direction: row;align-items: center;padding: 12px;background-color: #FFFFFF;">
			<view class="" @click="popBack()">
				<text class="iconfont icon-arrow-left" style="font-size: 16px;font-weight: bold;"></text>
				<text style="font-size: 16px;">标记为学生</text>
			</view>
			<view style="margin-left: 12px;
				flex: 1;
				background-color: #FFFFFF;
				display: flex;
				justify-content: flex-end;
				">
				<div @click="saveBtnClick" style="
					font-size: 14px;
					border: 1px solid #ebebeb;
					padding: 5px 12px;
					color: #FFFFFF;
					background-color: #007AFF;">
					保存</div>
			</view>
		</view>

		<!-- step -->
		<div style="padding:5px 12px;display: flex;align-items: center;background-color: #FFFFFF;">
			<div @click="tabclick(0)" style="flex:1;display: flex;flex-direction: column;align-items: center;">
				<div :style="{'font-size': '14px','color':tabindex==0?'#007AFF':'#333333'}">STEP1</div>
				<div :style="{'font-size': '14px','color':tabindex==0?'#007AFF':'#333333'}">填写基本信息</div>
			</div>
			<text class="iconfont icon-arrow-right"></text>
			<div @click="tabclick(1)" style="flex:1;display: flex;flex-direction: column;align-items: center;">
				<div :style="{'font-size': '14px','color':tabindex==1?'#007AFF':'#333333'}">STEP2</div>
				<div :style="{'font-size': '14px','color':tabindex==1?'#007AFF':'#333333'}">填写学校信息</div>
			</div>
			<text class="iconfont icon-arrow-right"></text>
			<div @click="tabclick(2)" style="flex:1;display: flex;flex-direction: column;align-items: center;">
				<div :style="{'font-size': '14px','color':tabindex==2 ? '#007AFF':'#333333'}">STEP3</div>
				<div :style="{'font-size': '14px','color':tabindex==2 ? '#007AFF':'#333333'}">填写跟进信息</div>
			</div>
		</div>

		<!-- form -->
		<div style="flex: 1;overflow-y: auto;">
			<step01 v-if="tabindex==0" @action="pageAction(1)" :data="maindata" />
			<step02 v-if="tabindex == 1" @action="pageAction(2)" :data="maindata" />
			<step03 v-if="tabindex==2" @action="pageAction(3)" :data="maindata" />
		</div>

	</view>
</template>

<script>
	import step01 from "./bindasbusiness-s1"
	import step02 from "./bindasbusiness-s2"
	import step03 from "./bindasbusiness-s3"
	import {
		addStudent
	} from "../../../api/person.js"
	export default {
		components: {
			step01,
			step02,
			step03,
		},
		data() {
			return {
				tabindex: 0,
				maindata: {}
			}
		},
		methods: {
			popBack() {
				uni.navigateBack({

				})
			},
			pageAction(idx) {
				this.tabindex = idx;
			},
			tabclick(idx) {
				this.tabindex = idx;
			},
			saveBtnClick() {
				this.netAddStudent();
			},
			netAddStudent() {
				addStudent({stuName:"123"}).then(res => {
					let {code} = res;
					if(code == 200) {
					// 	uni.$emit('hasBind',{data:true})
					// 	uni.navigateTo({
					// 		url:"/"
					// 	})
					debugger
					} else {
						uni.showToast({
							title:"添加失败请检查数据"
						})
					}
				}).catch(e => {
						uni.showToast({
							title:e
						})
				})
			}
		}
	}
</script>

<style scoped>
	.page {
		flex: 1;
		display: flex;
		flex-direction: column;
		background-color: #F5F5F5;
	}
</style>
